home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Saar AMOK 2
/
Saar AMOK II - Oktober 1994 (1994)(Kreativ Marketing)(DE)[!][I-7598].iso
/
disks
/
amok
/
amok_098
/
checknonexportident
/
checknonexportident.mod
< prev
next >
Wrap
Text File
|
1993-10-07
|
26KB
|
818 lines
MODULE CheckNonExportIdent;
IMPORT
rq: Requests,
Break,
mes:Messages,
io,
arg: Arguments,
str: Strings, ms: MoreStrings,
fs: FileSystem;
VAR
modulenameWritten: BOOLEAN;
procLevel: INTEGER;
filename: ARRAY 256 OF CHAR;
file: fs.File;
Char* : CHAR; (* letztes Zeichen von ReadChar() *)
CONST
versionString = "CheckNonExportIdent 1.0 (1.10.93) all Rights reserved";
PROCEDURE ReadOneChar();
BEGIN
IF ~fs.ReadChar(file,Char) THEN Char := CHR(0); END;
END ReadOneChar;
PROCEDURE ErrorOut(str: ARRAY OF CHAR);
BEGIN
IF ~ modulenameWritten THEN
modulenameWritten := TRUE;
io.WriteString(filename);
END;
io.WriteString(" ***SyntaxError***"); io.WriteLn; HALT(10);
END ErrorOut;
(* Alle Oberon Symbole: *)
CONST
plus * = 0; minus * = 1; times * = 2; divide * = 3;
not * = 4; and * = 5; point * = 6; comma * = 7;
semicolon * = 8; slash * = 9; lparen * = 10; langle * = 11;
lbrace * = 12; becomes * = 13; power * = 14; relation * = 15;
equal * = 16; range * = 21; colon * = 22;
rparen * = 23;
rangle * = 24; rbrace * = 25; array * = 26; begin * = 27;
case * = 28; close * = 29; const * = 30;
div * = 32; do * = 33; else * = 34; elsif * = 35;
end * = 36; exit * = 37; if * = 38; module * = 39;
import * = 40; in * = 41; is * = 42; loop * = 43;
mod * = 44; of * = 45; or * = 46; pointer * = 47;
procedure * = 48; record * = 49; repeat * = 50; return * = 51;
then * = 52; to * = 53; type * = 54; var * = 55;
until * = 56; with * = 57; while * = 58; identifier * = 59;
string * = 60; cnumber * = 61; cchar * = 62; struct * = 65;
bpointer * = 66; for * = 67; by * = 68; untraced * = 69;
eof * = 80; none * = 81; intstring * = 82;
intpoint * = 83; intnum * = 84; intcomp * = 85;
intid * = 86; intparen * = 87; intcolon * = 88;
(* none, intstring, intpoint, intnum, intcomp, intid, intparen und intcolon werden
nur intern in diesem Modul verwendet! *)
(* Allgemeiner Stringtyp: *)
TYPE
String * = ARRAY 80 OF CHAR;
StringPtr * = UNTRACED POINTER TO String;
LongStr * = ARRAY 512 OF CHAR;
CONST
OpSize = 61;
TYPE
OpPtr = UNTRACED POINTER TO Opera;
Opera = STRUCT
name: ARRAY 10 OF CHAR; (* Schlüsselwort *)
sym: INTEGER; (* sein Symbol *)
next: OpPtr; (* nächstes mit gleichem Key *)
END;
PROC = PROCEDURE;
ErrProc = PROCEDURE(str: ARRAY OF CHAR);
VAR
Sym: INTEGER; (* letzes Symbol *)
Operator: ARRAY OpSize OF OpPtr; (* Hash-Tabelle der Schlüsselworte *)
Syms: ARRAY 128 OF INTEGER; (* Symbole, am 1. Zeichen erkannt *)
StdId: ARRAY OpSize OF OpPtr; (* Hash-Tabelle der Standardbezeichner *)
i: INTEGER; (* zum leeren der Hashtabelle beim Initialisieren *)
c: CHAR;
ReadChar: PROC;
Error: ErrProc;
Identifier: String;
PreIdent: ARRAY 1024 OF CHAR;
PROCEDURE AppendPreIdent;
VAR
BEGIN
str.Append(PreIdent,Identifier);
str.AppendChar(PreIdent,".");
END AppendPreIdent;
PROCEDURE ShortenPreIdent();
VAR
pos: LONGINT;
BEGIN
pos := ms.OccursCharPos(PreIdent,".",-(str.Length(PreIdent)-2));
IF pos >= 0 THEN
PreIdent[pos+1] := CHR(0);
ELSE
PreIdent := "";
END;
END ShortenPreIdent;
(*-------------------------------------------------------------------------*)
PROCEDURE GetKey*(VAR str: ARRAY OF CHAR): INTEGER;
VAR i,j,key: INTEGER;
BEGIN
i := 0; key := 0;
WHILE str[i]#0X DO
(* $OvflChk- *)
key := key * 256;
INC(key,ORD(str[i]));
(* $OvflChk= *)
INC(i);
END;
IF key<0 THEN IF key=MIN(INTEGER) THEN key := MAX(INTEGER) ELSE key := -key END END;
RETURN key;
END GetKey;
PROCEDURE GetOp*(VAR s: String): OpPtr;
VAR
op: OpPtr;
BEGIN
op := Operator[GetKey(s) MOD OpSize];
WHILE (op#NIL) AND (s#op.name) DO
op := op.next;
END;
RETURN op;
END GetOp;
PROCEDURE GetStdId*(VAR s: String): OpPtr;
VAR
op: OpPtr;
BEGIN
op := StdId[GetKey(s) MOD OpSize];
WHILE (op#NIL) AND (s#op.name) DO
op := op.next;
END;
RETURN op;
END GetStdId;
(*-------------------------------------------------------------------------*)
PROCEDURE GetSym*;
(* Liest das nächste Symbol in die Variable Sym. *)
VAR
c: CHAR;
done: BOOLEAN;
(*------ Number: ------*)
PROCEDURE GetNumber;
(* wertet konstante Zahl aus. Bei Realzahlen wird der Bereich nicht geprüft! *)
VAR hex: BOOLEAN;
BEGIN
Sym := cnumber; hex := FALSE;
LOOP
CASE Char OF
"0".."9": |
"A".."F": hex := TRUE |
ELSE EXIT END;
ReadChar;
END;
CASE Char OF
"H","U": ReadChar; RETURN |
"X" : ReadChar; Sym := cchar; RETURN |
ELSE END;
IF hex THEN Error(mes.EDfinkonst) END;
CASE Char OF
".":
ReadChar; IF Char="." THEN Char := CHR(127); RETURN END;
WHILE (Char>="0") AND (Char<="9") DO ReadChar END;
CASE Char OF
"D","E":
ReadChar;
CASE Char OF "+","-": ReadChar ELSE END;
WHILE (Char>="0") AND (Char<="9") DO ReadChar END;
ELSE END;
ELSE END;
END GetNumber;
(*------ Identifier: ------*)
PROCEDURE GetIdentifier;
(* liest Bezeichner ein *)
VAR
cnt: INTEGER; (* Anzahl Zeichen *)
cap: BOOLEAN; (* nur Großbuchstaben? *)
cc: CHAR;
op: OpPtr;
BEGIN
(* Identifier einlesen: *)
cnt := 0; cap := TRUE; cc := CAP(Char);
REPEAT
cap := cap AND (cc=Char);
Identifier[cnt] := Char; ReadChar; cc := CAP(Char);
IF cnt<79 THEN INC(cnt) END;
UNTIL ((Char<"0") OR (Char>"9")) AND ((cc<"A") OR (cc>"Z"));
Identifier[cnt] := 0X;
(* Probe auf reserviertes Wort: *)
IF cap THEN
op := GetOp(Identifier);
IF op#NIL THEN Sym := op.sym; RETURN END;
END;
(* kein Standardbezeichner: *)
Sym := identifier;
END GetIdentifier;
(*------ Bemerkung: ------*)
PROCEDURE Remark;
BEGIN
ReadChar;
REPEAT
WHILE (Char#"*") AND (Char#0X) DO
IF Char="(" THEN ReadChar;
IF Char="*" THEN Remark() END
ELSE ReadChar END;
END;
ReadChar;
UNTIL (Char=")") OR (Char=0X);
IF Char=0X THEN Error(mes.EDendcomm) ELSE ReadChar END;
END Remark;
PROCEDURE NoSpecialChar;
BEGIN
WHILE (Char<=" ") OR (Char>7FX) DO
IF Char=0X THEN RETURN END;
ReadChar;
END;
END NoSpecialChar;
BEGIN
REPEAT
NoSpecialChar;
Sym := Syms[ORD(Char)]; IF Sym<none THEN ReadChar; RETURN END;
CASE Sym OF
intid: GetIdentifier |
intnum: GetNumber |
intparen: ReadChar; IF Char="*" THEN Remark; Sym:=none ELSE Sym:=lparen END |
intpoint: ReadChar; IF Char="." THEN Sym:=range; ReadChar ELSE Sym:=point END |
intcolon: ReadChar; IF Char="=" THEN Sym:=becomes; ReadChar ELSE Sym:=colon END |
intcomp:
Sym := relation; ReadChar; IF Char="=" THEN ReadChar END |
intstring:
c := Char;
done := FALSE;
REPEAT (* String einlesen *)
IF Char="\\" THEN ReadChar END;
ReadChar;
IF Char=c THEN
ReadChar;
NoSpecialChar;
IF Char=c THEN ReadChar ELSE done := TRUE END;
END;
UNTIL done OR (Char=0AX);
CASE Char OF 0X,0AX: Error(mes.EDsteuinstr) ELSE END;
Sym := string |
none: Error(mes.EDunerwzei); ReadChar |
END;
UNTIL Sym#none;
END GetSym;
(*-------------------------------------------------------------------------*)
PROCEDURE Parse* (rc: PROC; err: ErrProc);
(*# module = MODULE ident ";" [ImportList] DeclarationSequence
# [BEGIN StatementSequence] [CLOSE StatementSequence] END ident "." .
# ImportList = IMPORT import {"," import} ";" .
# import = identdef [":" ident]. *)
PROCEDURE Check(sym: INTEGER; text: ARRAY OF CHAR);
BEGIN IF Sym#sym THEN Error(text) END; GetSym END Check;
PROCEDURE CheckIdent; BEGIN Check(identifier,mes.EDbezerw ) END CheckIdent;
PROCEDURE CheckSemi; BEGIN Check(semicolon ,mes.EDsemierw) END CheckSemi;
PROCEDURE CheckColon; BEGIN Check(colon ,mes.EDcolerw ) END CheckColon;
PROCEDURE CheckEnd; BEGIN Check(end ,mes.EDenderw ) END CheckEnd;
PROCEDURE CheckOf; BEGIN Check(of ,mes.EDoferw ) END CheckOf;
PROCEDURE CheckDo; BEGIN Check(do ,mes.EDdoerw ) END CheckDo;
PROCEDURE CheckEqual; BEGIN Check(equal ,mes.EDglcherw) END CheckEqual;
PROCEDURE Checkrparen; BEGIN Check(rparen ,mes.EDklzuerw) END Checkrparen;
PROCEDURE Checkrbrace; BEGIN Check(rbrace ,mes.EDbrzuerw) END Checkrbrace;
PROCEDURE Checkrangle; BEGIN Check(rangle ,mes.EDanzuerw) END Checkrangle;
PROCEDURE CheckThen; BEGIN Check(then ,mes.EDthenerw) END CheckThen;
PROCEDURE CheckTo; BEGIN Check(to ,mes.EDtoerw ) END CheckTo;
PROCEDURE Times; BEGIN IF Sym=times THEN GetSym END END Times;
PROCEDURE IdentDef;
(*# identdef = ident ["*"|"-"].*)
BEGIN
CheckIdent;
CASE Sym OF
times,minus: GetSym
ELSE
IF procLevel = 0 THEN
IF ~ modulenameWritten THEN
modulenameWritten := TRUE;
io.WriteString(filename); io.WriteLn;
END;
io.WriteString(" "); io.WriteString(PreIdent);
io.WriteString(Identifier); io.WriteLn;
END;
END;
END IdentDef;
PROCEDURE Qualident;
(*# qualident = [ident "."] ident.*)
BEGIN CheckIdent; IF Sym=point THEN GetSym; CheckIdent END END Qualident;
PROCEDURE Semicolon(): BOOLEAN; BEGIN IF Sym=semicolon THEN GetSym; RETURN TRUE ELSE RETURN FALSE END END Semicolon;
PROCEDURE Comma(): BOOLEAN; BEGIN IF Sym=comma THEN GetSym; RETURN TRUE ELSE RETURN FALSE END END Comma;
PROCEDURE ^ Expression;
PROCEDURE ExpList;
(*# ExpList = expression {"," expression}. *)
BEGIN REPEAT Expression UNTIL NOT Comma() END ExpList;
PROCEDURE Elements;
(*# Elements = element {"," element}.
# element = expression [".." expression]. *)
BEGIN
REPEAT
Expression; IF Sym=range THEN GetSym; Expression END;
UNTIL NOT Comma();
END Elements;
PROCEDURE Set;
(*# set = "{" [element {"," element}] "}".
# element = expression [".." expression]. *)
BEGIN
GetSym; (* { *)
IF Sym#rbrace THEN Elements END;
Checkrbrace;
END Set;
PROCEDURE Designator;
(*# designator = qualident ( {"." ident | "[" ExpList "]" | "(" qualident ")" |
"^" } | set ). !!! geändert für LONGSET{} etc. *)
BEGIN
Qualident;
LOOP
CASE Sym OF
point: GetSym; CheckIdent |
langle: GetSym; ExpList; Checkrangle |
lparen: GetSym; IF Sym#rparen THEN ExpList END; Checkrparen |
power: GetSym |
lbrace: Set |
ELSE EXIT END;
END;
END Designator;
PROCEDURE Expression;
(*# expression = SimpleExpression [relation SimpleExpression].
# relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS. *)
PROCEDURE SimpleExpression;
(*# SimpleExpression = ["+"|"-"] term {AddOperator term}.
# AddOperator = "+" | "-" | OR . *)
PROCEDURE Term;
(*# term = factor {MulOperator factor}.
# MulOperator = "*" | "/" | DIV | MOD | "&" . *)
PROCEDURE Factor;
(*# factor = number | CharConstant | string | NIL | set |
# designator [ActualParameters] | "(" expression ")" | "~" factor. *)
BEGIN
CASE Sym OF
cnumber,cchar,string: GetSym |
identifier: Designator |
lparen: GetSym; Expression; Checkrparen |
not: GetSym; Factor |
lbrace: Set |
ELSE Error(mes.EDfakterw) END;
END Factor;
BEGIN
LOOP
Factor;
CASE Sym OF times,divide,div,mod,and: GetSym | ELSE EXIT END;
END;
END Term;
BEGIN
CASE Sym OF plus,minus: GetSym | ELSE END;
LOOP
Term;
CASE Sym OF plus,minus,or: GetSym | ELSE EXIT END;
END;
END SimpleExpression;
BEGIN
SimpleExpression;
CASE Sym OF equal,relation,in,is: GetSym; SimpleExpression ELSE END;
END Expression;
PROCEDURE ^ StatementSequence;
PROCEDURE StatSeqEnd; BEGIN StatementSequence; CheckEnd END StatSeqEnd;
PROCEDURE ^ FormalParameters;
PROCEDURE Type;
(*# type = qualident | ArrayType | RecordType | PointerType | ProcedureType.
# ArrayType = ARRAY [length {"," length}] OF type.
# length = ConstExpression.
# RecordType = RECORD ["(" BaseType ")"] FieldListSequence END.
# BaseType = qualident.
# FieldListSequence = FieldList {";" FieldList}.
# FieldList = [IdentList ":" type].
# PointerType = (BPOINTER | [UNTRACED] POINTER) TO type.
# ProcedureType = PROCEDURE [FormalParameters]. *)
BEGIN
CASE Sym OF
identifier: Qualident |
array: GetSym;
IF Sym#of THEN
Expression;
WHILE Sym=comma DO
GetSym;
Expression
END;
END;
CheckOf;
Type |
record,struct:
IF Sym=record THEN
GetSym;
IF Sym=lparen THEN GetSym; Qualident; Checkrparen END;
ELSE
GetSym;
IF Sym=lparen THEN
GetSym;
IdentDef;
CheckColon;
Qualident;
Checkrparen
END;
END;
REPEAT
IF Sym=identifier THEN
REPEAT IdentDef; UNTIL NOT Comma();
CheckColon; Type
END;
UNTIL NOT Semicolon();
CheckEnd |
untraced,pointer,bpointer:
IF Sym=untraced THEN
GetSym; Check(pointer,mes.EDptrerw)
ELSE
GetSym
END;
CheckTo; Type |
procedure: GetSym; FormalParameters;
ELSE Error(mes.EDtyperw) END;
END Type;
PROCEDURE FormalParameters;
(*# FormalParameters = "(" [FPSection {";" FPSection}] ")" [":" qualident].
# FPSection = [VAR] ident ["{" Expression "}" [".."]] {"," ident} ":" Type. *)
BEGIN
IF Sym=lparen THEN
GetSym;
IF Sym#rparen THEN
IF Sym#lparen THEN
REPEAT
IF Sym=var THEN GetSym END;
REPEAT
CheckIdent;
IF Sym=lbrace THEN
GetSym;
Expression;
Checkrbrace;
IF Sym=range THEN GetSym END;
END;
UNTIL NOT Comma();
CheckColon; Type;
UNTIL NOT Semicolon();
END;
END;
Checkrparen;
IF Sym=colon THEN GetSym; Qualident END;
END;
END FormalParameters;
PROCEDURE StatementSequence;
(*# StatementSequence = statement {";" statement}. *)
PROCEDURE Statement;
(*# statement = [assignment | ProcedureCall |
# IfStatement | CaseStatement | WhileStatement | RepeatStatement |
# LoopStatement | WithStatement | ForStatement | EXIT | RETURN [expression] ].
# assignment = designator ":=" expression.
# ProcedureCall = designator [ActualParameters].
# IfStatement = IF expression THEN StatementSequence
# {ELSIF expression THEN StatementSequence}
# [ELSE StatementSequence]
# END.
# CaseStatement = CASE expression OF case {"|" case} [ELSE StatementSequence] END.
# case = [CaseLabelList ":" StatementSequence].
# CaseLabelList = CaseLabels {"," CaseLabels}.
# CaseLabels = ConstExpression [".." ConstExpression].
# WhileStatement = WHILE expression DO StatementSequence END.
# RepeatStatement = REPEAT StatementSequence UNTIL expression.
# LoopStatement = LOOP StatementSequence END.
# WithStatement = WITH qualident ":" qualident DO StatementSequence END .
# ForStatement = FOR ident ":=" Expression TO Expression [BY ConstExpression]
# DO StatementSequence END. *)
PROCEDURE ElseEnd;
BEGIN
IF Sym=else THEN GetSym; StatementSequence END;
CheckEnd;
END ElseEnd;
BEGIN
CASE Sym OF
identifier: Designator; IF Sym=becomes THEN GetSym; Expression END |
if: REPEAT
GetSym; Expression; CheckThen; StatementSequence;
UNTIL Sym#elsif;
ElseEnd |
case: GetSym; Expression; CheckOf;
LOOP
WHILE Sym=slash DO GetSym END;
CASE Sym OF else,end: EXIT ELSE END;
Elements; CheckColon; StatementSequence;
IF Sym#slash THEN EXIT END;
END;
ElseEnd |
while: GetSym; Expression; CheckDo; StatSeqEnd |
repeat: GetSym; StatementSequence; Check(until,mes.EDuntilerw); Expression |
loop: GetSym; StatSeqEnd |
with: REPEAT
GetSym; Qualident; CheckColon; Qualident; CheckDo; StatementSequence;
UNTIL Sym#slash;
ElseEnd |
for: GetSym; CheckIdent; Check(becomes,mes.EDwirderw); Expression;
CheckTo; Expression;
IF Sym=by THEN GetSym; Expression END;
CheckDo; StatSeqEnd |
exit: GetSym |
return: GetSym;
CASE Sym OF semicolon,end,else,elsif,slash,until: |
ELSE Expression END |
ELSE END;
END Statement;
BEGIN
REPEAT
Statement;
UNTIL NOT Semicolon();
END StatementSequence;
PROCEDURE DeclarationSequence;
(*# DeclarationSequence = {CONST {ConstantDeclaration ";"} |
# TYPE {TypeDeclaration ";"} | VAR {VariableDeclaration ";"}}
# {ProcedureDeclaration ";" | ForwardDeclaration ";" |
# ExternProcDeclaration ";"}.
# ConstantDeclaration = identdef "=" ConstExpression.
# ConstExpression = expression.
# TypeDeclaration = identdef "=" type.
# VariableDeclaration = IdentList ":" type.
# ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
# ProcedureHeading = PROCEDURE ["*"] [Receiver] identdef [FormalParameters].
# ProcedureBody = DeclarationSequence [BEGIN StatementSequence] END.
# ForwardDeclaration = PROCEDURE "^" [Receiver] identdef [FormalParameters].
# Receiver = "(" [VAR] ident ":" ident ")".
# ExternProcDeclaration = PROCEDURE identdef "[" expression ["," expression] "]" . *)
VAR forward: BOOLEAN;
BEGIN
LOOP
CASE Sym OF
| const: GetSym; WHILE Sym=identifier DO IdentDef; CheckEqual; Expression; CheckSemi END;
| type: GetSym; WHILE Sym=identifier DO IdentDef; AppendPreIdent; CheckEqual; Type; CheckSemi; ShortenPreIdent; END;
| var:
GetSym;
WHILE Sym=identifier DO
REPEAT
IdentDef;
IF Sym=langle THEN GetSym; Expression; Checkrangle END;
UNTIL NOT Comma();
CheckColon; Type; CheckSemi;
END;
| procedure:
GetSym; forward := FALSE;
IF Sym=power THEN GetSym; forward := TRUE ELSE IF Sym=times THEN GetSym END END;
IF Sym=lparen THEN
GetSym;
IF Sym=var THEN GetSym END;
CheckIdent;
CheckColon;
CheckIdent;
Checkrparen;
END;
IdentDef;
INC(procLevel);
IF Sym=lbrace THEN
forward := TRUE;
GetSym;
Expression;
IF Sym=comma THEN GetSym; Expression END;
Checkrbrace;
END;
FormalParameters; CheckSemi;
IF NOT forward THEN
DeclarationSequence;
IF Sym=begin THEN GetSym; StatementSequence END;
CheckEnd; CheckIdent; CheckSemi;
END;
DEC(procLevel);
ELSE EXIT END;
ShortenPreIdent();
END;
END DeclarationSequence;
BEGIN
ReadChar := rc; Error := err; Char := " ";
GetSym;
REPEAT
Check(module,mes.EDmoderw); CheckIdent; CheckSemi;
IF Sym=import THEN
PreIdent := "IMPORT: ";
GetSym;
REPEAT
IdentDef; IF (Sym=colon) OR (Sym=becomes) THEN GetSym; CheckIdent END;
UNTIL NOT Comma();
CheckSemi;
PreIdent := "";
END;
DeclarationSequence;
IF Sym=begin THEN GetSym; StatementSequence END;
IF Sym=close THEN GetSym; StatementSequence END;
CheckEnd; CheckIdent; Check(point,mes.EDpkterw);
UNTIL Sym=eof;
END Parse;
(*-------------------------------------------------------------------------*)
PROCEDURE AddOp(sym: INTEGER (* Symbol *); op: ARRAY OF CHAR);
(* Operator zur Operatorenliste hinzufügen: *)
VAR
o: OpPtr;
i: INTEGER;
BEGIN
NEW(o); rq.Assert(o#NIL,mes.EDoom);
COPY(op,o.name);
o.sym := sym;
i := GetKey(op) MOD OpSize;
o.next := Operator[i]; Operator[i] := o;
END AddOp;
PROCEDURE AddStd(op: ARRAY OF CHAR);
(* Operator zur Operatorenliste hinzufügen: *)
VAR
o: OpPtr;
i: INTEGER;
BEGIN
NEW(o); rq.Assert(o#NIL,mes.EDoom);
COPY(op,o.name);
o.sym := identifier;
i := GetKey(op) MOD OpSize;
o.next := StdId[i]; StdId[i] := o;
END AddStd;
BEGIN
(* Standardoperatoren: *)
i := 0; WHILE i<OpSize DO Operator[i] := NIL; INC(i) END;
AddOp(and, "AND" ); AddOp(array, "ARRAY" );
AddOp(begin, "BEGIN" ); AddOp(bpointer, "BPOINTER" );
AddOp(by, "BY" ); AddOp(case, "CASE" );
AddOp(close, "CLOSE" ); AddOp(const, "CONST" );
AddOp(div, "DIV" ); AddOp(do, "DO" );
AddOp(else, "ELSE" ); AddOp(elsif, "ELSIF" );
AddOp(end, "END" ); AddOp(exit, "EXIT" );
AddOp(for, "FOR" ); AddOp(if, "IF" );
AddOp(import, "IMPORT" ); AddOp(in, "IN" );
AddOp(is, "IS" ); AddOp(loop, "LOOP" );
AddOp(mod, "MOD" ); AddOp(module, "MODULE" );
AddOp(not, "NOT" ); AddOp(of, "OF" );
AddOp(or, "OR" ); AddOp(pointer, "POINTER" );
AddOp(procedure,"PROCEDURE"); AddOp(record, "RECORD" );
AddOp(repeat, "REPEAT" ); AddOp(return, "RETURN" );
AddOp(struct, "STRUCT" ); AddOp(then, "THEN" );
AddOp(to, "TO" ); AddOp(type, "TYPE" );
AddOp(until, "UNTIL" ); AddOp(untraced, "UNTRACED" );
AddOp(var, "VAR" ); AddOp(while, "WHILE" );
AddOp(with, "WITH" );
AddStd("BOOLEAN" );
AddStd("CHAR" );
AddStd("BYTE" );
AddStd("SHORTINT");
AddStd("INTEGER" );
AddStd("LONGINT" );
AddStd("REAL" );
AddStd("LONGREAL");
AddStd("SHORTSET");
AddStd("LONGSET" );
AddStd("SET" );
AddStd("FALSE" );
AddStd("TRUE" );
AddStd("NIL" );
AddStd("ABS" );
AddStd("ASH" );
AddStd("CAP" );
AddStd("CHR" );
AddStd("COPY" );
AddStd("DEC" );
AddStd("DISPOSE" );
AddStd("ENTIER" );
AddStd("EXCL" );
AddStd("HALT" );
AddStd("INC" );
AddStd("INCL" );
AddStd("LEN" );
AddStd("LONG" );
AddStd("MAX" );
AddStd("MIN" );
AddStd("NEW" );
AddStd("ODD" );
AddStd("ORD" );
AddStd("SHORT" );
AddStd("SIZE" );
AddStd("SYSTEM" );
AddStd("ADR" );
AddStd("LSH" );
AddStd("ROT" );
(*AddStd("SIZE" ); s.o. *)
AddStd("INIT" );
AddStd("INLINE" );
AddStd("REG" );
AddStd("SETREG" );
AddStd("VAL" );
AddStd("ADDRESS" );
AddStd("TYPEDESC");
Syms[ORD("!")]:=none; Syms[ORD('"')]:=intstring; Syms[ORD("#")]:=relation;
Syms[ORD("$")]:=none; Syms[ORD("%")]:=none; Syms[ORD("&")]:=and;
Syms[ORD("'")]:=intstring;Syms[ORD("(")]:=intparen; Syms[ORD(")")]:=rparen;
Syms[ORD("*")]:=times; Syms[ORD("+")]:=plus; Syms[ORD(",")]:=comma;
Syms[ORD("-")]:=minus; Syms[ORD(".")]:=intpoint; Syms[ORD("/")]:=divide;
Syms[ORD(":")]:=intcolon; Syms[ORD(";")]:=semicolon; Syms[ORD("<")]:=intcomp;
Syms[ORD("=")]:=equal; Syms[ORD(">")]:=intcomp; Syms[ORD("?")]:=none;
Syms[ORD("@")]:=none; Syms[ORD("[")]:=langle; Syms[ORD("\\")]:=none;
Syms[ORD("]")]:=rangle; Syms[ORD("^")]:=power; Syms[ORD("_")]:=none;
Syms[ORD("`")]:=none; Syms[ORD("{")]:=lbrace; Syms[ORD("|")]:=slash;
Syms[ORD("}")]:=rbrace; Syms[ORD("~")]:=not; Syms[127 ]:=range;
Syms[0 ]:=eof;
c := "0"; REPEAT Syms[ORD(c)] := intnum; INC(c) UNTIL c>"9";
c := "A"; REPEAT Syms[ORD(c)] := intid; INC(c) UNTIL c>"Z";
c := "a"; REPEAT Syms[ORD(c)] := intid; INC(c) UNTIL c>"z";
filename := versionString;
arg.GetArg(1,filename);
IF fs.Open(file,filename,FALSE) THEN
Parse(ReadOneChar,ErrorOut);
IF fs.Close(file) THEN END;
IF modulenameWritten THEN HALT(5); END;
ELSE
io.WriteString("***Error opening file "); io.WriteString(filename); io.WriteLn;
HALT(20);
END;
END CheckNonExportIdent.